package com.qiaofang.applet.service.member.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.qiaofang.applet.common.base.BaseDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.CompoundIndexes;
import org.springframework.data.mongodb.core.mapping.Document;

import java.util.Date;

@Data
@Document(collection = "member_employee_report")
@ApiModel("经纪人数据报表")
@NoArgsConstructor
@AllArgsConstructor
@CompoundIndexes({
        // 唯一复合索引
        @CompoundIndex(name = "emp_reportDate", def = "{'employeeUniqueUuid' : 1, 'reportDate': 1}", unique = true)
})
public class EmployeeReport extends BaseDomain {

    @ApiModelProperty("经纪人唯一uuid")
    private String employeeUniqueUuid;

    @ApiModelProperty("姓名")
    private String employeeName;

    @ApiModelProperty("城市名")
    private String cityName;

    @ApiModelProperty("部门uuid")
    private String deptUuid;

    @ApiModelProperty("部门名")
    private String deptName;



    @ApiModelProperty("分享房源数")
    private long shareHouse;

    @ApiModelProperty("分享房源到微信")
    private long shareHouseWx;

    @ApiModelProperty("分享房源图片")
    private long shareHousePic;



    @ApiModelProperty("分享新房数")
    private long shareFirsthand;

    @ApiModelProperty("分享新房微信")
    private long shareFirsthandWx;

    @ApiModelProperty("分享新房图片")
    private long shareFirsthandPic;


    @ApiModelProperty("分享二手房数")
    private long shareSale;

    @ApiModelProperty("分享二手房微信")
    private long shareSaleWx;

    @ApiModelProperty("分享二手房图片")
    private long shareSalePic;


    @ApiModelProperty("分享租房数")
    private long shareRent;

    @ApiModelProperty("分享租房微信")
    private long shareRentWx;

    @ApiModelProperty("分享租房图片")
    private long shareRentPic;


    @ApiModelProperty("分享经纪人名片数")
    private long shareEmp;

    @ApiModelProperty("分享经纪人名片微信")
    private long shareEmpWx;

    @ApiModelProperty("分享经纪人名片图片")
    private long shareEmpPic;
    
    

    @ApiModelProperty("访问人数")
    private long visitNum;

    @ApiModelProperty("关注数")
    private long focusNum;

    @ApiModelProperty("粉丝数")
    private long fansNum;

    @ApiModelProperty("转发数")
    private long shareNum;

    @ApiModelProperty("在线聊天数")
    private long chatNum;

    @ApiModelProperty("电话咨询数")
    private long callNum;

    @ApiModelProperty("总互动")
    private long interactNum;

    @ApiModelProperty(value = "报表日期")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date reportDate;


    public void setAll() {
        this.shareFirsthand = shareFirsthandWx + shareFirsthandPic;
        this.shareSale = shareSaleWx + shareSalePic;
        this.shareRent = shareRentWx + shareRentPic;
        this.shareEmp = shareEmpWx + shareEmpPic;
        this.shareHouse = shareFirsthand + shareSale + shareRent;
        this.shareHouseWx = shareFirsthandWx + shareSaleWx + shareRentWx;
        this.shareHousePic = shareFirsthandPic + shareSalePic + shareRentPic;
        this.shareNum = shareEmp + shareHouse;
        this.interactNum = visitNum + focusNum + fansNum + shareNum + chatNum + callNum;
    }

}
